package com.open.capacity.controller;

import com.open.capacity.common.web.Result;
import com.open.capacity.model.ActivityModel;
import com.open.capacity.model.UserModel;
import com.open.capacity.service.ActivityService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: y_022
 * @date: 19:30-2021/6/24
 * @description:
 */
@Slf4j
@Api(tags = "ACTIVITY API")
@RestController
@RequestMapping("/activity")
public class ActivityController {
    @Autowired
    private ActivityService activityService;

    @GetMapping("/findActivityByUserId")
    public Result findActivityByUserId(UserModel userModel) {
        try {
            List<ActivityModel> activityModelList =  activityService.findActivityByUserId(userModel);
            return Result.succeed(activityModelList,"操作成功！");
        }catch (Exception e){
            log.error("活动查询错误");
        }
        return Result.failed("操作失败！");
    }
}
